# -*- coding: utf-8 -*-

"""
Python 集合示例 (List, Dict, Set)
"""

# 1. 集合 (Collections)
print("======== 1. 集合 (List, Dict, Set) ========")

# 列表 (List)
my_list = [1, "apple", 3.14]
my_list.append("orange")
print(f"列表 (List): {my_list}")

# 字典 (Dictionary - 对应 Java 的 Map)
my_dict = {"name": "Alice", "age": 30}
my_dict["city"] = "New York"
print(f"字典 (Dictionary): {my_dict}")

# 集合 (Set)
my_set = {1, 2, 3, 3, 4}
my_set.add(5)
print(f"集合 (Set): {my_set}")

def run_tests():
    assert len([1, 2, 3]) == 3
    assert len({"a": 1, "b": 2}) == 2
    assert len({1, 2, 2, 3}) == 3
    print("所有集合测试通过!")

if __name__ == "__main__":
    run_tests()